/**
 * 区域管理
 * @author luguoxiang
 * @date 2023-03-27
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
import { IConfigSchema, isJson } from '@/soar';

const fieldList: IConfigSchema<any>[] = [
  {
    label: '健',
    field: 'code',
    dataType: 'string',
    table: {
      width: 100,
    },
    form: {
      rules: true,
      disabled: ({ isUpdate }) => isUpdate,
    },
  },
  {
    label: '名称',
    field: 'name',
    dataType: 'string',
    table: {
      width: 100,
    },
    form: {
      rules: true,
    },
  },
  {
    label: '值',
    field: 'value',
    dataType: 'string',
    table: {
      ellipsis: true,
    },
    form: {
      slots: 'editor',
      rules: [
        {
          validator: (value) => {
            try {
              return isJson(value);
            } catch (e) {
              return false;
            }
          },
          message: '不符合json规范，注意字符串请加双引号',
        },
      ],
      formItemProps: {
        help: '字符串："lg-soar"，数值：2024，布尔值：true，数组：[1,"2",true]，对象：{name:"六哥",age:18}',
      },
    },
  },
  {
    label: '备注',
    field: 'remark',
    dataType: 'string',
    form: {
      component: 't-textarea',
    },
  },
  {
    label: '创建时间',
    field: 'createTime',
    table: {
      width: 160,
    },
    form: false,
  },
];

export default fieldList;
